package testSudoku;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;

import sudoku.QuestionFactory;
import sudoku.Sudoku_Question;

public class testQuestionFactory {
	private QuestionFactory Question_Generator;
	
	@Test
	public void test_create_question_easy() 
	{
		Sudoku_Question Question;
		Question_Generator=new QuestionFactory();
		Question = Question_Generator.create_question(1);
		char[][][] get_questn = Question.get_questn();
		
		char [][]expect_result = new char[][] {
				{'4','6','3','2',' ','9','7','1','8'},//array[0][0-8]
				{'7',' ',' ',' ',' ',' ',' ',' ','5'},//array[1][0-8]
				{'8',' ','5','7',' ','3','6',' ','2'},//array[2][0-8]
				{'3',' ','8','6',' ','2','5',' ','1'},//array[3][0-8]
				{' ','7',' ',' ','4',' ',' ','6',' '},//array[4][0-8]
				{'6',' ','2','3',' ','1','4',' ','9'},//array[5][0-8]
				{'2',' ','7','9',' ','4','1',' ','6'},//array[6][0-8]
				{'9',' ',' ',' ',' ',' ',' ',' ','4'},//array[7][0-8]
				{'5','8','4','1',' ','6','3','9','7'} //array[8][0-8]
		};
		assertArrayEquals(expect_result, get_questn[0]);
	}
	
	@Test
	public void test_create_question_medium() 
	{
		Sudoku_Question Question;
		Question_Generator=new QuestionFactory();
		Question = Question_Generator.create_question(2);
		char[][][] get_questn = Question.get_questn();
		
		char [][]expect_result = new char[][] {
				{' ',' ','6',' ',' ',' ','3',' ',' '},
				{' ','3',' ','4',' ','8',' ','1',' '},
				{'4','1','5',' ',' ',' ',' ','8','2'},
				{' ',' ','4','3',' ','1','2','6',' '},
				{'1',' ',' ',' ','4',' ',' ',' ','3'},
				{' ','7','8','2',' ','5','1',' ',' '},
				{'5','2',' ',' ',' ',' ','6','9','8'},
				{' ','4',' ','8',' ','3',' ','2',' '},
				{' ',' ','7',' ',' ',' ','4',' ',' '}
		};
		assertArrayEquals(expect_result, get_questn[0]);
	}
	
	@Test
	public void test_create_question_hard() 
	{
		Sudoku_Question Question;
		Question_Generator=new QuestionFactory();
		Question = Question_Generator.create_question(3);
		char[][][] get_questn = Question.get_questn();
		
		char [][]expect_result = new char[][] {
				{' ',' ',' ','2','9','1',' ',' ',' '},
				{'4',' ',' ','5',' ','3',' ',' ','7'},
				{' ',' ','3',' ',' ',' ','8',' ',' '},
				{'7',' ','4',' ','2',' ','1',' ','9'},
				{' ','8',' ',' ',' ',' ',' ','5',' '},
				{'2',' ','1',' ','4',' ','6',' ','3'},
				{' ',' ','2',' ',' ',' ','3',' ',' '},
				{'3',' ',' ','9',' ','2',' ',' ','6'},
				{' ',' ',' ','4','3','6',' ',' ',' '}
		};
		assertArrayEquals(expect_result, get_questn[0]);
	}
}
